package com.tongtailian.www.stir.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tongtailian.www.stir.R;
import com.tongtailian.www.stir.bean.ConfigBean;

import java.util.List;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * Created by liuml on 2020/9/6 16:48
 */
public class HomeSampleAdapter extends BaseQuickAdapter<ConfigBean, BaseViewHolder> {
    public HomeSampleAdapter(int layoutResId, @Nullable List<ConfigBean> data) {
        super(layoutResId, data);
    }

    //1、已完成
    //2、进行中
    //3、待完成
    //4、未选中（本次不用你处理）
    @Override
    protected void convert(@NonNull BaseViewHolder helper, ConfigBean item) {
        helper.setText(R.id.bt_item_name, item.getName());

        switch (item.getState()) {
            case 1:
                helper.setBackgroundRes(R.id.ll_item_bg, R.drawable.home_item_btn_select_doing_bg)
                        .setGone(R.id.iv_state, true)
                        .setBackgroundRes(R.id.iv_state, R.mipmap.finish);
                ;
                break;
            case 2:
                helper.setBackgroundRes(R.id.ll_item_bg, R.drawable.home_item_btn_select_doing_bg)
                        .setGone(R.id.iv_state, true)
                        .setBackgroundRes(R.id.iv_state, R.mipmap.refresh);
                ;
                break;
            case 3:
                helper.setBackgroundRes(R.id.ll_item_bg, R.drawable.home_item_btn_select_bg)
                        .setGone(R.id.iv_state, false);
                ;
                break;
            case 4:
                helper.setBackgroundRes(R.id.ll_item_bg, R.drawable.home_item_btn_default_bg)
                        .setGone(R.id.iv_state, false);
                break;

        }
//                .setText(R.id.bt_item_look, item.getLook());

//        helper.addOnClickListener(R.id.bt_item_look);
    }
}